このNotebookは、このイメージにインストールされたNotebook Extensionが予期した通りにインストールされていることをチェックするものです。Travis CI上でpapermillにより実行されます。

This notebooks tests whether the installed extensions work expectedly, and can be executed by papermill on Travis CI.

Installed extensions


In [1]:
nbextensions = !jupyter nbextension list 2>>/dev/null
nbextensions


Out[1]:
['Known nbextensions:',
 '  config dir: /home/bit_kun/.jupyter/nbconfig',
 '    notebook section',
 '      nbextensions_configurator/config_menu/main \x1b[32m enabled \x1b[0m',
 '      toc2/main \x1b[32m enabled \x1b[0m',
 '      multi_outputs/main \x1b[32m enabled \x1b[0m',
 '      dragdrop/main \x1b[32m enabled \x1b[0m',
 '      collapsible_headings/main \x1b[32m enabled \x1b[0m',
 '      nbextension_i18n_cells/main \x1b[32m enabled \x1b[0m',
 '      nblineage/main \x1b[32m enabled \x1b[0m',
 '      contrib_nbextensions_help_item/main \x1b[32m enabled \x1b[0m',
 '      run_through/main \x1b[32m enabled \x1b[0m',
 '    tree section',
 '      nbextensions_configurator/tree_tab/main \x1b[32m enabled \x1b[0m',
 '      notebook_index/main \x1b[32m enabled \x1b[0m',
 '  config dir: /usr/local/etc/jupyter/nbconfig',
 '    notebook section',
 '      jupyter-js-widgets/extension \x1b[32m enabled \x1b[0m']

In [2]:
import re
indent_pat = re.compile(r'^(\s+)([a-zA-Z\/_]+)\s+\S+\s+(.*)\s+\S+')
ext_status = [indent_pat.match(l) for l in nbextensions if indent_pat.match(l) and len(indent_pat.match(l).group(1)) == 6]
ext_status = dict([(m.group(2), m.group(3)) for m in ext_status])
ext_status


Out[2]:
{'nbextensions_configurator/config_menu/main': 'enabled',
 'multi_outputs/main': 'enabled',
 'dragdrop/main': 'enabled',
 'collapsible_headings/main': 'enabled',
 'nblineage/main': 'enabled',
 'contrib_nbextensions_help_item/main': 'enabled',
 'run_through/main': 'enabled',
 'nbextensions_configurator/tree_tab/main': 'enabled',
 'notebook_index/main': 'enabled'}

In [3]:
assert ext_status['multi_outputs/main'] == 'enabled'
assert ext_status['collapsible_headings/main'] == 'enabled'
assert ext_status['nblineage/main'] == 'enabled'
assert ext_status['run_through/main'] == 'enabled'
assert ext_status['notebook_index/main'] == 'enabled'

In [ ]: